package com.adam.springsecurity;

import lombok.Getter;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.oauth2.core.user.DefaultOAuth2User;

import java.util.Collection;
import java.util.Map;

/**
 * 此类已经没有存在的意义，仅剩枚举类定义有用
 */
@Getter
@Deprecated
public class MyOAuth2User extends DefaultOAuth2User {
    private final String nameAttributeKey;
    private final OAuthProvider OAuthProvider;
    /**
     * Constructs a {@code DefaultOAuth2User} using the provided parameters.
     *
     * @param authorities      the authorities granted to the user
     * @param attributes       the attributes about the user
     * @param nameAttributeKey the key used to access the user's &quot;name&quot; from
     *                         {@link #getAttributes()}
     */
    public MyOAuth2User(Collection<? extends GrantedAuthority> authorities, Map<String, Object> attributes, String nameAttributeKey, OAuthProvider OAuthProvider) {
        super(authorities, attributes, nameAttributeKey);
        this.nameAttributeKey = nameAttributeKey;
        this.OAuthProvider = OAuthProvider;
    }

    public enum OAuthProvider {
        GitHub,Huawei,Unknown
    }
}
